/* 
 * $Id$
 *
 * UMKC Robotics 2009
 *
 * Ryan Boyd (rmb972@umkc.edu / boydkuhawks@gmail.com)
**/
#ifndef PATH_H
#define PATH_H

#include "2space.h"
#include "intdefs.h"

/* a function pointer type that returns an int and
 * takes struct path* as its only argument.  struct
 * path is a forward decleration. */
struct path;
typedef int (*Fpath)(struct path *);


#define MAX_VERTICIES 50	
#define START_VERTEX 0
#define START_BUILD_VERTEX 1
#define END_VERTEX(path) ( path->numverts - 1 )
#define END_BUILD_VERTEX(path) ( path->numverts - 2 )
#define NUM_VERTS_TO_BUILD(path) ( path->numverts - 2 )
#define NUM_EDGES(path) ( path->numverts - 1 )
typedef struct path {
  Float_T a;
  Float_T r[MAX_VERTICIES];	
  Float_T x[MAX_VERTICIES];	
  Float_T y[MAX_VERTICIES];	
  int numverts;		
  Fpath path_builder_f;		
} Path;

#define E_NULL_PATH_FUNC 20

/* intarface for all user path manipulations. */ 
typedef struct pathctl {

  void (*reset)(Path*);
  int (*make)(Path*);
  void (*set_start_polar)(Path*, PolarPoint*);
  void (*set_start_rect)(Path*, RectangularPoint*);
  void (*set_end_polar)(Path*, PolarPoint*);
  void (*set_end_rect)(Path*, RectangularPoint*);
  void (*set_num_verticies)(Path*, int);
  void (*set_make_F)(Path*, Fpath);
  PolarPoint (*get_pos_polar)(Path*, int);
  RectangularPoint (*get_pos_rect)(Path*, int);

} PathCtl;

#endif
